home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.cs.arizona.edu
/
ftp.cs.arizona.edu.tar
/
ftp.cs.arizona.edu
/
icon
/
newsgrp
/
group96a.txt
/
000087_icon-group-sender _Mon Apr 15 22:23:35 1996.msg
< prev
next >
Wrap
Internet Message Format
|
1996-09-05
|
1KB
Received: by cheltenham.cs.arizona.edu; Mon, 15 Apr 1996 12:27:40 MST
Date: Mon, 15 Apr 1996 22:23:35 +0300 (WET)
From: Ehud Lamm <mslamm@pluto.mscc.huji.ac.il>
To: rjhare@ed.ac.uk
Cc: icon-group@cs.arizona.edu
Subject: Re: random numbers...
In-Reply-To: <9604150927.ab22893@uk.ac.ed.tattoo>
Message-Id: <Pine.A32.3.91.960415222108.56899A-100000@pluto.mscc.huji.ac.il>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Errors-To: icon-group-errors@cs.arizona.edu
Status: O
On 15 Apr 1996, R J Hare wrote:
> I'm writing a graphics program which requires that I perturb my x and
> y values randomly by -1|0|1 before plotting the object at the new x and y.
> There seem to be 2 obvious ways of doing this:
>
> x := x-2+?3
> y := y-2+?3
>
> or:
>
> x := x+?[-1,0,1]
> y := y+?[-1,0,1]
>
The second option is clearly easier to read...
This is a good example of the powerful semantics of Icon compared to
regualr languages that would make you use the first solution.
Soory I can not comment about speed, but of hand it seems the elegent
solution is the slower one... :-)
Ehud Lamm mslamm@pluto.mscc.huji.ac.il